package initialize

import (
	"os"
)

// redis-option
type RedisOption struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	UserName string `yaml:"username"`
	Password string `yaml:"password"`
}

// rabbit-option
type RabbitMQOption struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	UserName string `yaml:"username"`
	Password string `yaml:"password"`
}

// log-option
type LogsOption struct {
	LogPath  string `yaml:"logPath"`
	LogLevel string `yaml:"logLevel"`
}

// env-option
type Option struct {
	RedisOption    `yaml:"redis"`
	RabbitMQOption `yaml:"rabbitmq"`
	LogsOption     `yaml:"logs"`
}

// options
type Options struct {
	Dev  Option `yaml:"dev"`
	Pro  Option `yaml:"pro"`
	Test Option `yaml:"test"`
}

func (o *Options) GetEnv() Option {
	env := os.Getenv("WSCOINENV")
	switch env {
	case "dev":
		return o.Dev
	case "pro":
		return o.Pro
	default:
		return o.Test
	}
}
